package com.self.reflect;

import java.lang.reflect.Method;

public class ReflectTestMain {

    public static void main(String[] args) {

        testReflectImpl();
    }

    private static void testReflectImpl() {

        for (int i = 0; i < 17; i++) {

            Class type = ReflectTestMain.class;

            try {
                Method method = type.getDeclaredMethod("test",null);
                method.invoke(null,null);
            } catch (Exception e) {
                System.out.println(String.format("第%s次调用反射",i));
                e.printStackTrace();
                System.out.println("--------------------------------------------------");
            }

        }
    }

    private static void test() {
        System.out.println("test 执行");
        throw new RuntimeException();
    }
}
